package com.xgure.config;

import com.xgure.interceptor.JwtUserInterceptor;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Web MVC 配置
 */
@Configuration
public class WebMVCConfiguration implements WebMvcConfigurer {

    @Resource
    private JwtUserInterceptor jwtUserInterceptor;

    /**
     * 添加拦截器（开发时可以先注释掉）
     *
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(jwtUserInterceptor)
                .addPathPatterns("/user/**")
                .excludePathPatterns("/user/user/login")
                .excludePathPatterns("/user/user/status");
    }
}
